package com.hmy.infrastructure.api.client.dingtalk;

import com.hmy.ccp.common.result.FeignResult;
import com.hmy.infrastructure.api.bo.request.dingtalk.DeptBo;
import com.hmy.infrastructure.api.bo.request.dingtalk.GetUserRequest;
import com.hmy.infrastructure.api.bo.request.dingtalk.UserBo;
import com.hmy.infrastructure.api.bo.response.dingtalk.AppTokenResponse;
import com.hmy.infrastructure.api.bo.response.dingtalk.FailResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@FeignClient("hmy-ccp-infrastructure")
public interface DingTalkClient {

    @GetMapping("/feign/dingTalk/getAccessToken")
    FeignResult<AppTokenResponse> getAccessToken();

    @GetMapping("/feign/dingTalk/getCallBackFail")
    FeignResult<FailResult> getCallBackFail();

    @GetMapping("/feign/dingTalk/getUserDetail/{userId}")
    FeignResult<UserBo> getUserDetail(@PathVariable("userId") String userId);

    @PostMapping("/feign/dingTalk/getUserInfo")
    FeignResult<UserBo> getUserInfo(@RequestBody @Validated GetUserRequest getUserRequest);

    @GetMapping("/feign/dingTalk/getDeptDetail/{deptId}")
    FeignResult<DeptBo> getDeptDetail(@PathVariable("deptId") long deptId);

    @GetMapping("/feign/dingTalk/syncDeptData")
    FeignResult<List<DeptBo>> syncDeptData();

    @GetMapping("/feign/dingTalk/syncUserData")
    FeignResult<List<UserBo>> syncUserData();

}
